home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzList / BlitzListFiles / BlitzC2P.lha / programming / blitz2 / programs / c2p060only.ascii < prev    next >
Encoding:
Text File  |  1998-07-27  |  6.4 KB  |  410 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 040/25 results:
  5.  
  6. ; 320x200 @46.0fps DoublePAL or 48.2fps PAL
  7. ; 320x256 @34.2fps DoublePAL or 37.4fps PAL
  8. ; 320x240 @37.1fps DoublePAL or 40.1fps PAL
  9.  
  10. ; 060/50 results:
  11.  
  12. ; 320x256 @50fps PAL
  13. ; 320x200 @66fps PAL
  14.  
  15. #c2pBPLX=320
  16. #c2pBPLY=256
  17. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  18.  
  19. #scrwidth=#c2pBPLX
  20. #scrheight=#c2pBPLY
  21. #screensize=#scrwidth*#scrheight
  22.  
  23. ; c2p1x1_8_c5_060
  24.  
  25. Statement c2p060onlyinit{A.l,B.l}
  26.  
  27.   ;A.l=d0=Width.w
  28.   ;B.l=d0=Height.w
  29.  
  30. ; d0.w  chunkyx [chunky-pixels]
  31. ; d1.w  chunkyy [chunky-pixels]
  32. ; d3.w  scroffsy [screen-pixels]
  33.  
  34.   MOVEQ.l #0,d3 ; Y offset
  35.  
  36. c2p1x1_8_c5_060_init
  37.   LEA c2p_datanew(pc),a0
  38.   ANDI.l  #$ffff,d0
  39.   MULU.w  d0,d3
  40.   LSR.l #3,d3
  41.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  42.   MULU.w  d0,d1
  43.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  44. AsmExit
  45. End Statement
  46.  
  47. Statement c2p060only{A.l,B.l}
  48.  
  49.   MOVE.l  d0,a0 ; Chunky
  50.   MOVE.l  d1,a1 ; Planar
  51.  
  52. ; a0  c2pscreen
  53. ; a1  bitplanes
  54.  
  55. c2p1x1_8_c5_060
  56.   MOVE.w  #_xend-_x,d0
  57.  
  58.   MOVEM.l a3-a6,-(a7)
  59.  
  60.   MOVEM.l a0-a1,-(a7)
  61.   LEA c2p_datanew,a0
  62.   LEA c2p_data,a1
  63.   MOVEQ #16-1,d0
  64. _c2pcopy: MOVE.l  (a0)+,(a1)+
  65.   DBF d0,_c2pcopy
  66.   MOVEM.l (a7)+,a0-a1
  67.  
  68.   LEA c2p_data(pc),a2
  69.  
  70.   ADD.w #c2pBPLSIZE,a1
  71.   ADD.l c2p_scroffs-c2p_data(a2),a1
  72.  
  73.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  74.   ADD.l a0,a3
  75.  
  76.   MOVE.l  a1,a2
  77.   ADD.l #c2pBPLSIZE*4,a2
  78.  
  79.   CMP.l a0,a3
  80.   BEQ _none
  81.  
  82.   MOVE.l  (a0)+,d0
  83.   MOVE.l  (a0)+,d1
  84.   MOVE.l  (a0)+,d2
  85.   MOVE.l  (a0)+,d3
  86.  
  87.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  88.   MOVE.l  d1,d6
  89.   MOVE.l  d3,d7
  90.   LSR.l #4,d6
  91.   LSR.l #4,d7
  92.   EOR.l d0,d6
  93.   EOR.l d2,d7
  94.   AND.l d5,d6
  95.   AND.l d5,d7
  96.   EOR.l d6,d0
  97.   EOR.l d7,d2
  98.   LSL.l #4,d6
  99.   LSL.l #4,d7
  100.   EOR.l d6,d1
  101.   EOR.l d7,d3
  102.  
  103.   MOVE.l  d0,a4
  104.   MOVE.l  d1,a5
  105.   MOVE.l  d2,a6
  106.   MOVE.l  d3,d5
  107.  
  108.   MOVE.l  (a0)+,d0
  109.   MOVE.l  (a0)+,d1
  110.   MOVE.l  (a0)+,d2
  111.   MOVE.l  (a0)+,d3
  112.  
  113.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  114.   MOVE.l  d3,d7
  115.   LSR.l #4,d6
  116.   LSR.l #4,d7
  117.   EOR.l d0,d6
  118.   EOR.l d2,d7
  119.   AND.l #$0f0f0f0f,d6
  120.   AND.l #$0f0f0f0f,d7
  121.   EOR.l d6,d0
  122.   EOR.l d7,d2
  123.   LSL.l #4,d6
  124.   LSL.l #4,d7
  125.   EOR.l d6,d1
  126.   EOR.l d7,d3
  127.  
  128.   EXG d1,a4
  129.   EXG d3,a6
  130.  
  131.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  132.   MOVE.w  d2,d7
  133.   MOVE.w  d1,d0
  134.   MOVE.w  d3,d2
  135.   SWAP  d0
  136.   SWAP  d2
  137.   MOVE.w  d0,d1
  138.   MOVE.w  d2,d3
  139.   MOVE.w  d6,d0
  140.   MOVE.w  d7,d2
  141.  
  142.   BRA _start
  143. _x
  144.   MOVE.l  (a0)+,d0
  145.   MOVE.l  (a0)+,d1
  146.   MOVE.l  (a0)+,d2
  147.   MOVE.l  (a0)+,d3
  148.  
  149.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  150.  
  151.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  152.   MOVE.l  d1,d6
  153.   MOVE.l  d3,d7
  154.   LSR.l #4,d6
  155.   LSR.l #4,d7
  156.   EOR.l d0,d6
  157.   EOR.l d2,d7
  158.   AND.l d5,d6
  159.   AND.l d5,d7
  160.   MOVE.l  a6,-c2pBPLSIZE(a1)
  161.   EOR.l d6,d0
  162.   EOR.l d7,d2
  163.   LSL.l #4,d6
  164.   LSL.l #4,d7
  165.   EOR.l d6,d1
  166.   EOR.l d7,d3
  167.  
  168.   MOVE.l  a5,d7
  169.  
  170.   MOVE.l  d0,a4
  171.   MOVE.l  d1,a5
  172.   MOVE.l  d2,a6
  173.   MOVE.l  d3,d5
  174.  
  175.   MOVE.l  (a0)+,d0
  176.   MOVE.l  (a0)+,d1
  177.   MOVE.l  (a0)+,d2
  178.   MOVE.l  (a0)+,d3
  179.  
  180.   MOVE.l  d7,(a1)+
  181.  
  182.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  183.   MOVE.l  d3,d7
  184.   LSR.l #4,d6
  185.   LSR.l #4,d7
  186.   EOR.l d0,d6
  187.   EOR.l d2,d7
  188.   AND.l #$0f0f0f0f,d6
  189.   AND.l #$0f0f0f0f,d7
  190.   EOR.l d6,d0
  191.   EOR.l d7,d2
  192.   LSL.l #4,d6
  193.   LSL.l #4,d7
  194.   EOR.l d6,d1
  195.   EOR.l d7,d3
  196.  
  197.   EXG d1,a4
  198.   EXG d3,a6
  199.  
  200.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  201.   MOVE.w  d2,d7
  202.   MOVE.w  d1,d0
  203.   MOVE.w  d3,d2
  204.   SWAP  d0
  205.   SWAP  d2
  206.   MOVE.w  d0,d1
  207.   MOVE.w  d2,d3
  208.   MOVE.w  d6,d0
  209.   MOVE.w  d7,d2
  210.  
  211.   MOVE.l  d4,c2pBPLSIZE-4(a1)
  212. _start
  213.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 1 & 3
  214.   MOVE.l  d0,d6
  215.   MOVE.l  d2,d7
  216.   LSR.l #2,d6
  217.   LSR.l #2,d7
  218.   EOR.l d1,d6
  219.   EOR.l d3,d7
  220.   AND.l d4,d6
  221.   AND.l d4,d7
  222.   EOR.l d6,d1
  223.   EOR.l d7,d3
  224.   LSL.l #2,d6
  225.   LSL.l #2,d7
  226.   EOR.l d6,d0
  227.   EOR.l d7,d2
  228.  
  229.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 1 & 3
  230.   MOVE.l  d2,d6
  231.   MOVE.l  d3,d7
  232.   LSR.l #8,d6
  233.   LSR.l #8,d7
  234.   EOR.l d0,d6
  235.   EOR.l d1,d7
  236.   AND.l d4,d6
  237.   AND.l d4,d7
  238.   EOR.l d6,d0
  239.   EOR.l d7,d1
  240.   LSL.l #8,d6
  241.   LSL.l #8,d7
  242.   EOR.l d6,d2
  243.   EOR.l d7,d3
  244.  
  245.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 1 & 3
  246.   MOVE.l  d2,d6
  247.   MOVE.l  d3,d7
  248.   LSR.l #1,d6
  249.   LSR.l #1,d7
  250.   EOR.l d0,d6
  251.   EOR.l d1,d7
  252.   AND.l d4,d6
  253.   AND.l d4,d7
  254.   EOR.l d6,d0
  255.   EOR.l d7,d1
  256.   MOVE.l  d1,c2pBPLSIZE*2(a2)
  257.   ADD.l d6,d6
  258.   ADD.l d7,d7
  259.   EOR.l d6,d2
  260.   EOR.l d7,d3
  261.  
  262.   EXG a5,d0
  263.   EXG d5,d1
  264.   EXG a4,d2
  265.   EXG a6,d3
  266.  
  267.   MOVE.w  d2,d6     ; Swap 16x4, parts 2 & 4
  268.   MOVE.w  d3,d7
  269.   MOVE.w  d0,d2
  270.   MOVE.w  d1,d3
  271.   SWAP  d2
  272.   SWAP  d3
  273.   MOVE.l  a6,c2pBPLSIZE(a2)
  274.   MOVE.w  d2,d0
  275.   MOVE.w  d3,d1
  276.   MOVE.w  d6,d2
  277.   MOVE.w  d7,d3
  278.  
  279.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 2 & 4
  280.   MOVE.l  d2,d6
  281.   MOVE.l  d3,d7
  282.   LSR.l #2,d6
  283.   LSR.l #2,d7
  284.   EOR.l d0,d6
  285.   EOR.l d1,d7
  286.   AND.l d4,d6
  287.   AND.l d4,d7
  288.   EOR.l d6,d0
  289.   EOR.l d7,d1
  290.   LSL.l #2,d6
  291.   LSL.l #2,d7
  292.   MOVE.l  a5,(a2)+
  293.   EOR.l d6,d2
  294.   EOR.l d7,d3
  295.  
  296.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 2 & 4
  297.   MOVE.l  d1,d6
  298.   MOVE.l  d3,d7
  299.   LSR.l #8,d6
  300.   LSR.l #8,d7
  301.   EOR.l d0,d6
  302.   EOR.l d2,d7
  303.   AND.l d4,d6
  304.   AND.l d4,d7
  305.   EOR.l d6,d0
  306.   EOR.l d7,d2
  307.   LSL.l #8,d6
  308.   LSL.l #8,d7
  309.   MOVE.l  a4,-c2pBPLSIZE-4(a2)
  310.   EOR.l d6,d1
  311.   EOR.l d7,d3
  312.  
  313.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 2 & 4
  314.   MOVE.l  d1,d6
  315.   MOVE.l  d3,d7
  316.   LSR.l #1,d6
  317.   LSR.l #1,d7
  318.   EOR.l d0,d6
  319.   EOR.l d2,d7
  320.   AND.l d4,d6
  321.   AND.l d4,d7
  322.   EOR.l d6,d0
  323.   EOR.l d7,d2
  324.   ADD.l d6,d6
  325.   ADD.l d7,d7
  326.   EOR.l d6,d1
  327.   EOR.l d7,d3
  328.  
  329.   MOVE.l  d0,d7
  330.   MOVE.l  d1,d4
  331.   MOVE.l  d2,a5
  332.   MOVE.l  d3,a6
  333.  
  334.   CMP.l a0,a3
  335.   BNE _x
  336. _xend
  337.  
  338.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  339.   MOVE.l  d4,c2pBPLSIZE(a1)
  340.   MOVE.l  a5,(a1)+
  341.   MOVE.l  a6,-c2pBPLSIZE-4(a1)
  342. _none
  343.   MOVEM.l (a7)+,a3-a6
  344. AsmExit
  345.  
  346.   Even4
  347. c2p_data
  348. c2p_screen: Dc.l 0
  349. c2p_scroffs: Dc.l 0
  350. c2p_pixels: Dc.l 0
  351.   Ds.l  16
  352.   Even4
  353. c2p_datanew
  354.   Ds.l  16
  355. End Statement
  356.  
  357.  
  358.  
  359.  
  360. .blitzprogram
  361. ; Setup
  362. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  363. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  364. InitPalette 0,256
  365. For c=0 To 255
  366.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  367. Next c
  368. AGAPalRGB 0,0,0,0,0
  369. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  370. Use Palette 0
  371. VWait 50
  372. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  373.  
  374. ; Put something into the chunky buffer so we can see it working
  375. GetReg a0,baseaddress1
  376. MOVE.l  #0,d0
  377. MOVE.l  #screensize-1,d1
  378. cloop
  379.   MOVE.b  d0,(a0)+
  380.   ADDQ.l  #1,d0
  381.   SUBQ.l  #1,d1
  382.   TST.l   d1
  383.   BLT     done
  384.   BRA     cloop
  385. done
  386.  
  387. ; Do the c2p test
  388. c2p060onlyinit{#scrwidth,#scrheight}
  389. VWait 20
  390. Forbid_
  391. VWait
  392. ResetTimer
  393. For time=1 To 800
  394.   c2p060only{baseaddress1,Bank(0)} ; Convert chunky to planar
  395. Next time
  396. t=Ticks
  397. VWait 2 : Permit_
  398. VWait 20
  399. FindScreen 0
  400. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  401. WindowOutput 0
  402. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  403. NPrint " "
  404. NPrint "Press mousebutton..."
  405. Free Screen 0
  406. MouseWait
  407. Free Window 0
  408. End
  409.  
  410.